Contents |
The Web Services package, WS::Server, is not a standalone application, but rather is designed be a "module" of TclHttpd. The following command is normally placed in httpdthread.tcl:
To load the webservices server package, do:
package require WS::Server
This command will only load the server the first time it is used, so it causes no ill effects to put this in each file declaring a service or service procedure.
The code that defines a service is normally placed in one or more files in the custom directory.
Procedure Name : ::WS::Server::Service
Description : Declare a Web Service, the following URLs will exist
/service/<ServiceName> Displays an HTML page describing the service /service/<ServiceName>/wsdl Returns a WSDL describing the service /service/<ServiceName>/op Invoke an operation
Arguments : this procedure uses position independed arguments, they are:
-host - The host name for this serice Defaults to "localhost" -decription - The HTML description for this service -xmlnamespace - Extra XML namespaces used by the service -service - The service name (this will also be used for the Tcl namespace of the procedures that implement the operations. -premonitor - This is a command prefix to be called before an operation is called. The following arguments are added to the command prefix: PRE serviceName operationName operArgList -postmonitor - This is a command prefix to be called after an operation is called. The following arguments are added to the command prefix: POST serviceName operationName OK|ERROR results -inheaders - List of input header types. -outheaders - List of output header types. -checkheader - Command prefix to check headers. If the call is not to be allowed, this command should raise an error. The signature of the command must be: cmd \ service \ operation \ caller_ipaddr \ http_header_list \ soap_header_list
Returns : Nothing
Side-Effects : None
Exception Conditions :
MISSREQARG -- Missing required arguements
Pre-requisite Conditions : None
Procedure Name : ::WS::Server::ServiceProc
Description : Register an operation for a service and declare the procedure to handle the operations.
Arguments :
ServiceName -- Name of the service this operation is for NameInfo -- List of three elements: 1) OperationName -- the name of the operation 2) ReturnType -- the type of the procedure return, this can be a simple or complex type 3) Description -- description of the return method Arglist -- List of argument definitions, each list element must be of the form: 1) ArgumentName -- the name of the argument 2) ArgumentTypeInfo -- -- A list of: {type typeName comment commentString} typeName can be any simple or defined type. commentString is a quoted string describing the field Documentation -- HTML describing what this operation does Body -- The tcl code to be called when the operation is invoked. This code should return a dictionary with <OperationName>Result as a key and the operation's result as the value.
Returns : Nothing
Side-Effects :
A proceedure named "<ServiceName>::<OperationName>" defined A type name with the name <OperationName>Result is defined.
Exception Conditions : None
Pre-requisite Conditions : ::WS::Server::Server must have been called for the ServiceName